/*
 * @Description: 弹窗组件
 * @Author: ziwei.ma
 * @Date: 2019-07-31 16:37:43
 * @Last Modified by: ziwei.ma
 * @Last Modified time: 2019-08-28 18:31:24
 */
<template>
  <mask-module
    ref="mask"
    class="flex-h flex-vc flex-hc"
    :isClickBgToHide="true"
  >
    <div class="remark-wrapper flex-v">
      <div class="remark">
        <textarea
          class="fontsize32"
          maxlength="200"
          v-model="contentVal"
          placeholder="备注"
        ></textarea>
        <div class="word-count fontsize28">{{contentVal.length}}/200</div>
      </div>

      <div class="flex-h btn-wrapper">
        <div
          style="color:#333333;"
          @click="hide"
        >取消</div>
        <div
          class="confirm baseColorNoAcitve"
          @click="clickConfirm"
        >确定</div>
      </div>
    </div>
  </mask-module>
</template>

<script>
import AnimatedDialog from '@/components/animateddialog/AnimatedDialog'
export default {
  components: {
    'mask-module': AnimatedDialog
  },
  data() {
    return {
      contentVal: '',
      textNumVal: 0
    }
  },
  computed: {
    mask() {
      return this.$refs.mask
    }
  },
  methods: {
    show() {
      this.contentVal = this.$store.getters.remark
      this.mask.show()
    },
    hide() {
      this.mask.hide()
    },
    clickConfirm() {
      this.$store.dispatch('fetchRemark', this.contentVal)
      this.hide()
    }
  },
  watch: {

  }
}
</script>

<style scoped>
.remark-wrapper {
  width: 640px;
  height: 432px;
  border-radius: 16px;
  background-color: #ffffff;
}
.remark {
  position: relative;
  width: 608px;
  height: 264px;
  background-color: #f9f9f9;
  border-radius: 8px;
  margin: 32px 16px 48px;
  padding: 16px 32px 52px 32px;
  box-sizing: border-box;
}
.remark > textarea {
  width: 100%;
  height: 100%;
  border: none;
  resize: none;
  background: transparent;
}
.word-count {
  position: absolute;
  bottom: 12px;
  right: 32px;
  color: #333333;
  font-size: 28px;
}
.btn-wrapper {
  height: 85px;
  width: 100%;
  border-top: 1px solid #cccccc; /*no*/
}
.btn-wrapper > div {
  width: 50%;
  font-size: 36px;
  line-height: 85px;
  text-align: center;
}
.confirm {
  border-left: 1px solid #cccccc; /*no*/
}
</style>
